import GeweChatSDK from "@/util/sdk/gewe_chat_sdk";
import SiliconflowSdk from "@/util/sdk/siliconflow_sdk";
import { Application } from "egg";

const geweChatSDK = new Map<string, GeweChatSDK>();

// 挂载到 ctx.app 上
export default {
  get geweChatSDKClient() {
    const { config } = this as Application;
    const {
      thirdPartyConfig: {
        cewechat: { url },
      },
    } = config;
    return new GeweChatSDK({ url });
  },

  get siliconflowSdkClient() {
    const { config } = this as Application;
    const {
      thirdPartyConfig: {
        siliconflow: { url, api },
      },
    } = config;

    return new SiliconflowSdk({ apiUrl: url, api });
  },

  get geweChatSDKCache(): Map<string, GeweChatSDK> {
    return geweChatSDK;
  },
};
